From: Owen W. Taylor Date: Sat, 12 Feb 2011 21:14:12 +0000 (-0500) Subject: Animate workspace indicator before adding/removing workspaces X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8962 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e9a45190e428b09f58531e4dc3678b9cbb97a6d2;p=gnome-shell.git Animate workspace indicator before adding/removing workspaces Rather than killing the workspace indicator indicator when we remove workspaces because the source and target locations might have changed, do it as a separate first step. This provides a better explanation than doing it simultaneously with the addition/removal or not at all and also keeps our computations simple. https://bugzilla.gnome.org/show_bug.cgi?id=641881 --- diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index c810b9fb2..021628720 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -397,6 +397,7 @@ ThumbnailsBox.prototype = { this._scale = 0; this._pendingScaleUpdate = false; this._stateUpdateQueued = false; + this._animatingIndicator = false; this._stateCounts = {}; for (key in ThumbnailState) @@ -476,15 +477,6 @@ ThumbnailsBox.prototype = { } this._queueUpdateStates(); - - // If we removed the current workspace, then metacity will have already - // switched to an adjacent workspace. Leaving the animation we - // started in response to that around will look funny because it's an - // animation for the *old* workspace configuration. So, kill it. - // If we animate the workspace removal in the future, we should animate - // the indicator as part of that. - Tweener.removeTweens(this._thumbnailIndicator); - this._constrainThumbnailIndicator(); }, syncStacking: function(stackIndices) { @@ -529,7 +521,11 @@ ThumbnailsBox.prototype = { _updateStates: function() { this._stateUpdateQueued = false; - // First thing to do is to start sliding out any thumbnails that have been destroyed + // If we are animating the indicator, wait + if (this._animatingIndicator) + return; + + // Then slide out any thumbnails that have been destroyed this._iterateStateThumbnails(ThumbnailState.REMOVING, function(thumbnail) { this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT); @@ -780,13 +776,18 @@ ThumbnailsBox.prototype = { this._indicator.width = oldAllocation.x2 - oldAllocation.x1; this._indicator.height = oldAllocation.y2 - oldAllocation.y1; + this._animatingIndicator = true; Tweener.addTween(this._indicator, { x: thumbnail.actor.allocation.x1, y: thumbnail.actor.allocation.y1, time: WorkspacesView.WORKSPACE_SWITCH_TIME, transition: 'easeOutQuad', - onComplete: Lang.bind(this, - this._constrainThumbnailIndicator) + onComplete: function() { + this._animatingIndicator = false; + this._constrainThumbnailIndicator(); + this._queueUpdateStates(); + }, + onCompleteScope: this }); } };